package com.lill.common.component.model;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class P implements Serializable {

	private static final long serialVersionUID = 7830807613892602365L;
	
	private boolean r;
	private String m;
	private Map<String, Object> attr;
	
	public P() {
		this.r = true;
	}
	
	public P put(String key, Object value) {
		if(null==attr){
			attr=new HashMap<String, Object>();
		}
		attr.put(key, value);
        return this;
    }
	
	public static P ok() {
		P p = new P();
		return p;
	}
	
	public static P ok(String msg) {
        P p = new P();
        p.setM(msg);
        return p;
    }
	
	public static P fail() {
		P p = new P();
		p.setR(false);
		return p;
	}
	
	public static P fail(String msg) {
		P p = new P();
		p.setR(false);
		p.setM(msg);
		return p;
	}
	
	public boolean isR() {
		return r;
	}
	public void setR(boolean r) {
		this.r = r;
	}
	public String getM() {
		return m;
	}
	public void setM(String m) {
		this.m = m;
	}
	public Map<String, Object> getAttr() {
		return attr;
	}
	public void setAttr(Map<String, Object> attr) {
		this.attr = attr;
	}
}
